<?php

namespace App\Admin\Forms;

use Dcat\Admin\Widgets\Form;

class SconfForm extends Form
{
    /**
     * Handle the form request.
     *
     * @param array $input
     *
     * @return mixed
     */
    public function handle(array $input)
    {
        // dump($input);
        admin_setting($input);
        // return $this->response()->error('Your error message.');

        return $this
				->response()
				->success('保存成功')
				->refresh();
    }

    /**
     * Build a form here.
     */
    public function form()
    {
        $this->text('host','系统域名')->default(admin_setting('host', 'www.mengyunblog.com'))->required();
        $this->text('name','系统名称')->default(admin_setting('name', '六一云米'))->required();
        $this->text('title','系统标题')->default(admin_setting('title', '智能链接管理平台-域名转发'))->required();
        $this->text('keywords','关键词')->default(admin_setting('keywords', 'www.mengyunblog.com'))->required();
        $this->textarea('description','描述词')->default(admin_setting('description', 'www.mengyunblog.com'))->required();
        $this->editor('user_footer','用户中心底部代码')->default(admin_setting('user_footer', 'Copyright © 2022 一六云米发'))->required();
        $this->textarea('domain_jx','域名解析地址')->rows(5)->default(admin_setting('domain_jx', '<td>A</td>
        <td>999</td>'))->required();
    }

    /**
     * The data of the form.
     *
     * @return array
     */
    public function default()
    {
        return [
            'recharge'  => admin_setting('recharge')

        ];
    }
}
